package models

import (
	"time"
)

type Finger struct {
	Id               int       `xorm:"not null pk autoincr comment('自增主键') INT(11)"`
	UserId           int       `xorm:"not null comment('用户自增id外键关联dts_user表中的id') index INT(11)"`
	InstitutionCode  string    `form:"finger_code" xorm:"comment('运管统一编号') VARCHAR(16)"`
	TerminalId       int       `xorm:"not null comment('终端id外键关联dts_terminal表中的id') INT(11)"`
	Finger           string    `xorm:"default 'L4' comment('指纹记录来源R:右手，L:左手；1:小拇指，2:无名指，3:中指，4:食指，5:大拇指') ENUM('L1','L2','L3','L4','L5','R1','R2','R3','R4','R5')"`
	ImageUrl         string    `form:"image_url" xorm:"not null comment('指纹图片') VARCHAR(255)"`
	FingerIdentifier string    `xorm:"default '' comment('指纹识别码') VARCHAR(512)"`
	AddTime          time.Time `xorm:"not null comment('指纹添加时间') DATETIME"`
	Status           string    `xorm:"default '0' comment('指纹合法性审核状态，0：待审核，1：通过审核，2：未通过审核') ENUM('0','1','2')"`
}

func (c *Finger) GetFingerById(id int) (list *Finger, err error) {
	if _, err = engine.Table("dts_finger").Where("id = ?", id).Get(list); err != nil {
		return list, err
	}
	return list, nil
}
